#! /usr/bin/tclsh

# Script logging location

set homeDir /Users/reverend
set appDir splitTracks
set logDir $homeDir/logs/$appDir

set now [clock seconds]
set year [clock format $now -format %Y]
set month [clock format $now -format %m]
set day [clock format $now -format %d]

set logDir $logDir/$year/$month/$day
set logFile app.log
set outputFile app.out

file mkdir $logDir

proc log {msg} {
    set f [open $::logDir/$::logFile a]
    puts $f "[clock format [clock seconds]] : $msg"
    close $f
}

# log "==== splitTracks starting ===="

if {[list length $argv] != 1} {
    puts "Usage: splitTracks <infoFile>"
    exit 0
} else {
    set fileName $argv
}

# sox the_chronic.aiff "The Chronic (Intro).aiff" trim 0 1:58

puts "the filename is $fileName"
